<extend name="Layout:ly2"/>

<block name="head">
    <script type="text/javascript">
        $(function () {
            $("#btn-submit").click(function () {
                var id = $("input[name='id']").val();
                var name = $("input[name='name']").val();
                if (name == '') {
                    layer.msg('专家名不能为空');
                    return false;
                }
                $.get("{:U('Admin/ExpertLevel/level_edit')}", {
                    'action': 'edit',
                    'id': id,
                    'name': name,
                }, function (msg) {
                    if (msg == 1) {
                        layer.msg("更新成功，1秒后自动关闭~~", {ico: 1, time: 1000}, function () {
                            parent.window.location.reload();    //刷新父页面
                        })
                    } else if (msg == 2) {
                        layer.msg("参数异常，1秒后自动关闭~~", {ico: 1, time: 1000}, function () {
                            parent.window.location.reload();    //刷新父页面
                        })
                    } else {
                        layer.msg("更新失败，1秒后自动关闭~~", {ico: 1, time: 1000}, function () {
                            parent.window.location.reload();    //刷新父页面
                        })
                    }
                })
            })
        })
    </script>
</block>

<block name="body">
    <div class="container-fluid">
        <h3 id="title" align="center">专家分类编辑</h3>
        <div class="padding20">
            <div class="form-horizontal p90">
                <input type="hidden" name="id" value="{$data['level_id']}"/>
                <div class="form-group">
                    <label class="col-sm-2 control-label">专家职称：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="name" value="{$data.expert_name}"/>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" id="btn-submit" class="btn btn-success">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
                    <button type="reset" class="btn btn-default">重置</button>
                </div>
            </div>
        </div>
    </div>
    </div>
</block>